package interview.sync.array;/*

 */

import java.util.concurrent.CountDownLatch;

/**
 * @ClassName CountDownLatchDemo
 * @Author Final
 * @Project DataStructures
 */
public class CountDownLatchDemo {

    public static void main(String[] args) throws InterruptedException {

        //创建计数器
        CountDownLatch countDownLatch=new CountDownLatch(6);
        for (int i=0;i<=6;i++){
            new Thread(()->{
                System.out.println(Thread.currentThread().getName()+"--------------");

                //-1；
                countDownLatch.countDown();
            },"1").start();
        }

        countDownLatch.await();
        System.out.println("结束");
    }
}
